package com.bestcem.xm.ticket.enums;

import lombok.Getter;
import lombok.ToString;

import javax.annotation.Nullable;

/**
 * @author liheng
 * @version v1.0
 * @date 2021/8/19 12:38
 */
@ToString
@Getter
public enum TicketNotifyConfigEventEnum {

    /**
     * 自动创建工单
     */
    CREATED_TICKET(0, "CREATED_TICKET"),

    /**
     * 跟进通知
     */
    FOLLOW_REMIND(1, "FOLLOW_REMIND"),
    /**
     * 跟进逾期
     */
    FOLLOW_OVERDUE(2, "FOLLOW_OVERDUE"),
    /**
     * 收到审核
     */
    RECEIVE_AUDIT(3, "RECEIVE_AUDIT"),
    /**
     * 审核通知
     */
    AUDIT_REMIND(4, "AUDIT_REMIND"),

    /**
     * 审核逾期
     */
    AUDIT_OVERDUE(5, "AUDIT_OVERDUE"),
    /**
     * 自动跟进
     */
    CHANGE_FOLLOW(6, "CHANGE_FOLLOW"),
    /**
     * TICKETS_STATISTICS
     */
    TICKETS_STATISTICS(7, "TICKETS_STATISTICS"),
    /**
     * 仅通知, 预警
     */
    ONLY_NOTIFY(8, "ONLY_NOTIFY");

    private final String name;
    private final Integer index;

    TicketNotifyConfigEventEnum(Integer index, String name) {
        this.name = name;
        this.index = index;
    }

    @Nullable
    public static TicketNotifyConfigEventEnum getByIndex(Integer index) {
        for (TicketNotifyConfigEventEnum value : values()) {
            if (value.getIndex().equals(index)) {
                return value;
            }
        }
        return null;
    }
}
